#pragma once

#include "publicgui_global.h"
#include <QDockWidget>
#include <QTreeWidget>

class QListWidget;
class QTreeWidgetItem;
class QListWidgetItem;
class QMenu;
class QAction;

namespace VrDataCore
{
	class StatusActor;
	class DeviceActor;
}

namespace CoreBase
{
	class ActorBase;
}

namespace PublicGui
{
	class DynamicTreeWidgetItemBase;

	class PUBLICGUI_EXPORT DevicePropertyTree : public QTreeWidget
	{
		Q_OBJECT
	public:
		DevicePropertyTree(QWidget * parent = 0);
		~DevicePropertyTree();
		void setCurrentStatus(VrDataCore::StatusActor* currentstatus);
	private:
		void addActorItem(QTreeWidgetItem* parentitem,CoreBase::ActorBase* effectactor);
		void setUpWidget(QTreeWidgetItem* parent);
		void setItemWidgetActor(CoreBase::ActorBase* actor,const QString& classname);
		VrDataCore::DeviceActor*					_currentDeviceActor;
		VrDataCore::StatusActor*					_currentStatusActor;
		QMap<QString,DynamicTreeWidgetItemBase*>	_groupToItem;
		QMenu*										_mainMenu;
		QMenu*										_addeffectMenu;
		QAction*									_actionAddAnimationEffect;
		QAction*									_actionDelete;
		QAction*									_actionRename;
		QAction*									_actionAddBillboardNodeEffect;
		QAction*									_actionAddTextureBillboardEffect;
		QAction*									_actionAddBlinkEffect;
		QAction*									_actionAddBubbleEffect;
		QAction*									_actionAddAlphaEffect;
		QAction*									_actionAddSoundEffect;
		QAction*									_actionMergerAnotherNode;
		QAction*									_actionFloatingOnTheWater;
		QAction*									_actionAddBlinkLight;
		bool										_showContextMenu;
	private slots:
		void addAnimationEffect(bool);
		void show_contextmenu(const QPoint&);
		void updataStatus();
		void slotsDelete(bool);
		void slotsRename(bool);
		void slotsAddBillboardNodeEffect(bool);
		void slotsAddTextureBillboardEffect(bool);
		void slotsAddBubbleEffect(bool);
		void slotsAddBlinkEffect(bool);
		void slotsAddAlphaEffect(bool);
		void slotsAddSoundEffect(bool);
		void slotsFloatingOnTheWater(bool);
		void slotsAddBlinkLight(bool);
		void slotSelecteActorObjectChanged(QVector<CoreBase::ActorBase*>);
		void slotsChangeSingleSceneObject(QVector<CoreBase::ActorBase*>);
	};

	class PUBLICGUI_EXPORT DeviceDefineWidget:public QDockWidget
	{
		Q_OBJECT
	public:
		DeviceDefineWidget(QWidget * parent = 0);
		~DeviceDefineWidget();

		void setDeviceActor(CoreBase::ActorBase* deviceactor);
	private:
		void initStatusListWidget();
		QListWidget*					_statusWidget;
		DevicePropertyTree*				_propertyTree;
		VrDataCore::DeviceActor*		_currentDeviceActor;
		QListWidgetItem*				_currentListWidgetItem;
		QMenu*							_mainMenu;
		QAction*						_actionAddStatus;
		QAction*						_actionRemoveStatus;
	private slots:
		void slotsItemDoubleClicked(QListWidgetItem*);
		void slotsChangeSingleSceneObject(QVector<CoreBase::ActorBase*>);
		void show_contextmenu(const QPoint&);
		void updataStatus();
		void slotsAddStatus(bool);
		void slotsRemoveStatus(bool);
	};
}